package com.iflytek.yly.jetpackdemo.lifecycle;

import android.content.Intent;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.iflytek.yly.jetpackdemo.R;

public class LifeCycleDemo3Activity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_lifecycle_service);

        findViewById(R.id.tv_start_service).setOnClickListener(v -> {
            Intent intent = new Intent(LifeCycleDemo3Activity.this, MyService.class);
            startService(intent);
        });

        findViewById(R.id.tv_stop_service).setOnClickListener(v -> {
            Intent intent = new Intent(LifeCycleDemo3Activity.this, MyService.class);
            stopService(intent);
        });
    }
}